package org.example.concole;

import io.netty.channel.Channel;
import org.example.LoginRequestPacket;

import java.util.Scanner;

public class LoginConsoleCommand implements ConsoleCommand {
    @Override
    public void exec(Scanner scanner, Channel channel) {
        System.out.println("请输入用户名：");
        String userName = scanner.nextLine();
        //  发送登录请求指令，服务器去处理登录请求报文
        LoginRequestPacket loginRequestPacket = new LoginRequestPacket();
        loginRequestPacket.setUsername(userName);
        loginRequestPacket.setPassword("defaultPwd");
        channel.writeAndFlush(loginRequestPacket);
    }
}
